Skip to content

fix(api): Map update order/collapsed to API field names#228

Merged
goncalossilva merged 2 commits intomainfrom
goncalossilva/order-mapping
Mar 4, 2026
Merged

fix(api): Map update order/collapsed to API field names#228
goncalossilva merged 2 commits intomainfrom
goncalossilva/order-mapping

Conversation

@goncalossilva
Copy link
Member

@goncalossilva goncalossilva commented Mar 3, 2026

Follow-up to #223 and consequently Doist/Todoist#26685, Doist/Todoist#26686, and Doist/Todoist#26687.

This makes order/collapsed work without bumping into missing functionality or naming conflicts. I opted to keep order and collapsed at the SDK level for better overall ergonomics and intra-SDK naming conventions.

The changes themselves are tiny. Most of the diff is in testing, where we now more explicitly ensure mapping works.

@goncalossilva goncalossilva requested a review from a team as a code owner March 3, 2026 14:50
Copilot AI review requested due to automatic review settings March 3, 2026 14:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns SDK-level update parameters (order, collapsed) with the Todoist REST API’s expected payload field names to avoid naming conflicts while keeping the SDK interface ergonomic.

Changes:

  • Map order/collapsed to API fields (child_order/section_order, is_collapsed) when updating tasks, projects, and sections.
  • Extend update_project and update_section to support order and collapsed.
  • Update test fixtures and add payload-mapping tests to validate the outgoing request JSON.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
todoist_api_python/api_async.py Maps update payload fields and extends async project/section update parameters.
todoist_api_python/api.py Maps update payload fields and extends sync project/section update parameters.
tests/test_models.py Updates model parsing assertions to match current API response field names.
tests/test_api_tasks.py Adds assertions verifying request payload mapping for task updates.
tests/test_api_sections.py Adds assertions verifying request payload mapping for section updates.
tests/test_api_projects.py Adds assertions verifying request payload mapping for project updates.
tests/data/test_defaults.py Updates default API response fixtures to the newer field names used in responses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Keep SDK parameters ergonomic by handling the mapping internally:

- Map task/project update `order` -> `child_order`
- Map section update `order` -> `section_order`
- Map update `collapsed` -> `is_collapsed` (task/project/section)
@goncalossilva goncalossilva force-pushed the goncalossilva/order-mapping branch from e349317 to 4b890a1 Compare March 3, 2026 15:11
Copy link

@doist-bot doist-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This update maps the order and collapsed fields to their respective API field names while maintaining consistent naming conventions within the SDK. The implementation enhances ergonomics and ensures the library remains intuitive to use, and no issues were flagged during the review.

Share FeedbackReview Logs

Copy link

@chiara-doist chiara-doist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, I'm fine with the naming conventions as they are intentional. Nice work!

@goncalossilva goncalossilva merged commit 2a35e9c into main Mar 4, 2026
5 checks passed
@goncalossilva goncalossilva deleted the goncalossilva/order-mapping branch March 4, 2026 11:34
Copy link
Collaborator

@lefcha lefcha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants